<template>
    <div class="list_page_div">
        <page-list :loading="loading" :table-config="tableConfig" :data-list="dataList" :height="height"  show-index
                   show-page :total="total" :currentPage="param.pageNum" :pageSize="param.pageSize" @currentChange="handleCurrentChange"
                   show-expand>
            <template #searchArea>
                <el-input v-model="param.operateMethod" clearable placeholder="操作功能" style="width: 200px;"></el-input>
                <el-date-picker v-model="param.operateTime" type="date" placeholder="选择日期" value-format="yyyy-MM-dd"></el-date-picker>
                <el-button type="primary" @click="searchList">查询</el-button>
                <el-button type="primary" @click="resetData">重置</el-button>
            </template>

            <template #expandContent="props">
                <div class="table_info">
                    <div class="table_item_info">
                        <label>操作人员：</label>
                        <span>{{ props.row.operateUserName }}</span>
                    </div>
                    <div class="table_item_info">
                        <label>功能说明：</label>
                        <span>{{ props.row.operateMethod }}</span>
                    </div>
                    <div class="table_item_info">
                        <label>操作结棍：</label>
                        <span>{{ $common.getDicName('operateReason', props.row.operateReason) }}</span>
                    </div>
                    <div class="table_item_info">
                        <label>入参参数：</label>
                        <span class="table_item_content" style="width: 800px;">{{ props.row.operateContent }}</span>
                    </div>
                    <div class="table_item_info">
                        <label>异常信息：</label>
                        <span class="table_item_content" style="width: 800px;">{{ props.row.errorLog }}</span>
                    </div>
                </div>
            </template>

            <template #item_operateReason="scope">
                {{ $common.getDicName('operateReason', scope.row.operateReason) }}
            </template>

        </page-list>
    </div>
</template>

<script>
import PageList from "@/components/grid/pageList";

export default {
    name: "logList",
    components: {PageList},
    data() {
        return {
            height: '500px',
            loading: false,

            tableConfig: [
                {label: "操作人", prop: "operateUserName", width: 220},
                {label: "操作功能", prop: "methodName", width: 300},
                {label: "操作编号", prop: "methodCode", minWidth: 300},
                {label: "操作地址", prop: "ipAddress", width: 200},
                {label: "操作结果", prop: "operateReason", width: 80, slot: true},
                {label: "操作时间", prop: "operateTime", width: 200},
            ],
            dataList: [],
            total: 0,
            param: {
                range: 1,
                operateMethod: '',
                operateTime: '',
                field: 'operate_time',
                order: 'desc',
                pageSize: 20,
                currentPage: 1,
            }
        }
    },
    mounted() {
        this.$nextTick(() => {
            this.height = (document.body.offsetHeight - 185) + "px";
        })
        this.searchList();
    }, methods: {
        handleCurrentChange(val) {
            this.param.pageNum = val;
            this.searchList();
        },
        resetData() {
            this.param.pageNum = 1;
            this.param.operateTime = '';
            this.searchList();
        },
        searchList() {
            this.loading = true;
            this.$axios.post("/CHILD_SYSTEM/systemOperateLog/getPageList", this.param).then(res => {
                this.total = res.data.total;
                this.dataList = res.data.rows;
            }).finally(() => {
                this.loading = false;
            })
        },
    }
}
</script>

<style scoped>

</style>